#include"Common.hpp"


class init
{
public:
    init()
    {
        int mk=mkfifo(fifoname.c_str(),fifomode);
        if(mk==-1)
        {
            exit(-1);
            cout<<"创建管道失败"<<endl;
        }
        cout<<"mkfifo sucess"<<endl;
    }
    ~init()
    {
        int rm=unlink(fifoname.c_str());
        if(rm==-1)
        {
            cout<<"管道删除失败"<<endl;
        }
        cout<<"fifo rm sucess"<<endl;
    }
};

 init initpipe;


char get[gsize];
int main()
{
    OperatFile rfile;
    rfile.OpenFide(openr);


    while (true)
    {
        int size=read(rfile.Fd(),get,gsize);
        if(size==0) break;
        get[size]=0;
        cout<<"接收信息:";
        cout<<get<<endl;       
    }

    return 0;
}